package com.xx.pmis.services.implementations;

import java.util.List;

import com.xx.pmis.model.Write;
import com.xx.pmis.persistence.dao.WriteDAO;
import com.xx.pmis.services.WriteService;

public class WriteServiceImpl implements WriteService {
	WriteDAO writeDAO = null;

	public WriteServiceImpl(WriteDAO writeDAO) {
		super();
		this.writeDAO = writeDAO;
	}

	public void saveOrUpdateWrite(Write write) throws Exception {
		writeDAO.saveOrUpdate(write);
	}

	public void saveWrite(Write write) throws Exception {
		writeDAO.save(write);
	}

	public void deleteWrite(Write write) throws Exception {
		writeDAO.delete(write);
	}

	public Write getWriteByWriteID(String writeID) throws Exception {
		Write write = writeDAO.getWriteByWriteID(writeID);
		return write;
	}

	public List<Write> getAllWrite() throws Exception {
		List<Write> writes = writeDAO.getAllWrite();
		return writes;
	}

	public List<Write> getAllWriteByPage(int currentPage, int lineSize) throws Exception {
		List<Write> writes = writeDAO.getAllWriteByPage(currentPage, lineSize);
		return writes;
	}

	public int getCountOfWrite() throws Exception {
		return writeDAO.getAllWrite().size();
	}


}
